package Exercise01;

import java.util.Objects;

public class Student {

    String name;
    String sex ;
    int  age;
    public Student(String name) {
        this.name = name;
    }

    public Student() {
    }

    public Student(String name, String color, int money) {
        this.name = name;
        this.sex = color;
        this.age = money;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getColor() {
        return sex;
    }

    public void setColor(String color) {
        this.sex = color;
    }

    public double getMoney() {
        return age;
    }

    public void setMoney(int money) {
        this.age = money;
    }

    @Override
    public String toString() {
        return "Demo{" +
                "name='" + name + '\'' +
                ", color='" + sex + '\'' +
                ", money=" + age +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student that = (Student) o;
        return age == that.age &&
                Objects.equals(name, that.name) &&
                Objects.equals(sex, that.sex);
    }

    @Override
    public int hashCode() {

        return Objects.hash(name, sex, age);
    }
}
